package cn.com.bluemoon.daps.system.entity;

import cn.com.bluemoon.daps.common.domain.BaseModel;
import cn.com.bluemoon.daps.common.enums.AuditStatus;
import cn.com.bluemoon.daps.common.enums.SystemType;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * <p>
 * 系统表
 * 一个系统对应多个稽核报告
 * {@link DapSystemInfo#getId()}关联多个{@link DapAuditSystemResult#getSystemId()}
 *
 * </p>
 *
 * @author admin
 * @since 2020-08-03
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors
@ApiModel(value = "DapSystemInfo", description = "系统表")
public class DapSystemInfo extends BaseModel<DapSystemInfo> {

    private static final long serialVersionUID = 1L;


    /**
     * {@link DapAuditSystemResult#getAuditResultId()}
     * 1.稽核完成后进行回填改值
     */
    @ApiModelProperty(value = "稽核结果表id")
    private String auditResultId;

    /**
     * 稽核情况
     * 待稽核 (默认)
     * 稽核中
     * 已稽核
     */
    @ApiModelProperty(value = "对应到系统的稽核状态：0 待稽核 1稽核中 2已稽核")
    @EnumValue
    private AuditStatus auditStatus;

    @ApiModelProperty(value = "稽核时间，记录上一次稽核的时间或说最新稽核时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime auditTime;

    @ApiModelProperty(value = "系统下所有模型中取最新已发布的时间")
    @TableField(exist = false)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime modelTopNewestPublishTime;

    @ApiModelProperty(value = "系统描述")
    private String description;

    @ApiModelProperty(value = "系统名称,唯一拘束")
    private String name;

    @ApiModelProperty(value = "系统名称简称")
    private String nameShorter;

    /**
     * 系统类型
     * 业务系统
     * 数仓系统
     * 数据产品
     * 其他
     * {@link } {@link SystemType#getCode()}
     */
    @EnumValue
    @ApiModelProperty(value = "系统分类，1 :业务系统,2 :数仓系统,3 :数据产品,4 :其他,5 :工具平台")
    @JsonFormat
    private SystemType type;

    @ApiModelProperty(value = "系统内部编号")
    private String sysCode;

    @ApiModelProperty(value = "关联业务线id")
    private Integer bizLineId;
}
